package cn.itcast.order.pojo;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.SchedulerException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

@Component
public class MyClusteredJob extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        // 在这里执行你的任务逻辑
        try {
            System.out.println("MyClusteredJob is executing on node " + context.getScheduler().getSchedulerInstanceId());
        } catch (SchedulerException e) {
            throw new RuntimeException(e);
        }
    }
}